<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        html,
        body {
            width: 100%;
            height: 100%;
            background-color: white;
            overflow: hidden;
        }

        div {
            width: 200px;
            height: 200px;
            margin: 100px auto;
            border-radius: 50%;
            background-color: black;
        }
    </style>
</head>

<body>
    <div></div>
</body>

</html>
<script>
    var bj = document.querySelector('body')
    var deng = document.querySelector('div')
    var flag = false
    deng.onclick = function () {
        if (flag == false) {
            deng.style.background = 'white'
            bj.style.background = 'black'
            flag = true
        } else {
            bj.style.background = 'white'
            deng.style.background = 'black'
            flag = false
        }
    }

</script>